package com.cms.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cms.dao.mapper.CustomerFieldDefMapper;
import com.cms.exception.SystemDBException;
import com.cms.model.TrCustomerFieldDef;
import com.cms.service.CustomerFieldDefService;

@Service
public class CustomerFieldDefServiceImpl implements CustomerFieldDefService{

	@Autowired
	private CustomerFieldDefMapper customerFieldDefMapper;
	
	@Override
	public void addCustomerFieldDefs(String catalog,List<TrCustomerFieldDef> defs)
			throws SystemDBException {
		this.deleteCustomerFieldDef(catalog);
		if(defs!=null&&!defs.isEmpty())
		{
		customerFieldDefMapper.addCustomerFieldDefs(defs);		
	    }
	}

	@Override
	public void deleteCustomerFieldDef(String catalog) throws SystemDBException {
		customerFieldDefMapper.deleteCustomerFieldDef(catalog);		
	}

}
